import Vue from 'vue'
import App from './App'
import store from './store'
Vue.prototype.$store = store
//bus总线
Vue.prototype.$bus = new Vue();
Vue.config.productionTip = false
// #ifdef APP-PLUS

plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
	Vue.prototype.$version = widgetInfo.version;
})

// #endif
const tui = {
	toast: function(text, duration, success) {
		uni.showToast({
			title: text,
			icon: success ? 'success' : 'none',
			duration: duration || 2000
		})
	},
}

Vue.prototype.tui = tui
App.mpType = 'app'
// #ifdef APP-PLUS
var innerAudioContext = uni.getBackgroundAudioManager();
innerAudioContext.title = '贝贝';
innerAudioContext.singer = '暂无';
innerAudioContext.coverImgUrl = 'static/logo2.png';
Vue.prototype.ScanAudio = function() {
	innerAudioContext.src = 'static/music/2.mp3';
	innerAudioContext.play(); //执行播放
}
Vue.prototype.stopaudio = function() {
	console.log(innerAudioContext);
	innerAudioContext.stop();
}
innerAudioContext.onEnded(() => {
	console.log('end');
	// 下面src的内容和上面的src保持一致可以循环播放
	innerAudioContext.src = 'static/music/2.mp3';
	innerAudioContext.play(); //执行播放
});
Vue.prototype.destroyaudio = function() {
	innerAudioContext.destroy();
}
// #endif

const app = new Vue({
	...App
})
app.$mount()
